Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cache packages to CacheDir #68

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Conversation

mylk
Copy link

@mylk mylk commented Aug 26, 2019

Related to #60.

Caches the made packages to CacheDir as defined in pacman.conf.

aurget Outdated Show resolved Hide resolved
aurget Outdated
@@ -333,6 +344,7 @@ set_defaults() {
sync_mode='install'
temp_directory='/tmp/aurget'
user_config="${XDG_CONFIG_HOME:-$HOME/.config}/aurgetrc"
pkg_cache_dir=$((grep -m 1 '^CacheDir' /etc/pacman.conf || echo 'CacheDir = /var/cache/pacman/pkg') | sed 's/CacheDir = //')
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
pkg_cache_dir=$((grep -m 1 '^CacheDir' /etc/pacman.conf || echo 'CacheDir = /var/cache/pacman/pkg') | sed 's/CacheDir = //')
pkg_cache_dir=$(sed '/^CacheDir *=[^ ]*\(.*\)$/\1/' /etc/pacman.conf)
pkg_cache_dir=${pkg_cache_dir:-/var/cache/pacman/pkg}

I forget, do we intend to respect a PACMAN_CONF environment variable? We might need to, if we want to test this behavior.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't have a PACMAN_CONF env variable and I couldn't find any mention on pacman.conf man page either.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right, this would be something we'd invent for our own use case, to make this configurable. It's not a super compelling use-case but it makes it much easier to test.

@pbrisbin pbrisbin added the restyle-ignore Ignore PR in Restyled label Sep 3, 2019
Repository owner deleted a comment from restyled-io bot Sep 3, 2019
@pbrisbin
Copy link
Owner

pbrisbin commented Sep 4, 2019

This code LGTM but I think it should be opt-in behind a flag and config option, it could be surprising to just start happening. WDYT?

@aragon999
Copy link
Contributor

Maybe also have a look at the two shellcheck issues which would be introduced through this pull request:
https://codeclimate.com/github/pbrisbin/aurget/pull/68

Base automatically changed from master to main February 3, 2021 21:56
@@ -333,6 +349,8 @@ set_defaults() {
sync_mode='install'
temp_directory='/tmp/aurget'
user_config="${XDG_CONFIG_HOME:-$HOME/.config}/aurgetrc"
pkg_cache_dir=$(sed -n 's/^CacheDir[ \t]*\=[ \t]*//p' /etc/pacman.conf)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Redirect error to /dev/null; default path defined later
pkg_cache_dir=$(sed -n 's/^CacheDir[ \t]=[ \t]//p' /etc/pacman.conf 2>/dev/null)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
restyle-ignore Ignore PR in Restyled
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants